using B.S.NewMedical.Api.Read.Application.Command.MobileService.Price;
using B.S.NewMedical.Api.Read.DTOS.Price;
using B.S.NewMedical.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace B.S.NewMedical.Api.Read.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class PriceController : ControllerBase
    {
        private readonly IMediator _mediator;

        public PriceController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 获取价格服务类型列表
        /// </summary>
        /// <param name="deptId">科室ID，可选</param>
        /// <param name="doctorLevel">医生级别，可选</param>
        /// <returns>价格服务类型列表</returns>
        [HttpGet("service-types")]
        public async Task<ApiResult<List<PriceServiceTypeDto>>> GetServiceTypes(
            [FromQuery] int? deptId = null, 
            [FromQuery] string doctorLevel = null)
        {
            return await _mediator.Send(new GetPriceServiceTypesCommand(deptId, doctorLevel));
        }

        /// <summary>
        /// 获取价格条目列表
        /// </summary>
        /// <param name="typeId">服务类型ID，可选</param>
        /// <returns>价格条目列表</returns>
        [HttpGet("items")]
        public async Task<ApiResult<List<PriceItemDto>>> GetPriceItems(
            [FromQuery] int? typeId = null)
        {
            return await _mediator.Send(new GetPriceItemsCommand { TypeId = typeId });
        }
    }
} 